// ui/admin-ui/src/api/coachCourse.js
import service from '@/utils/request.js'

// 教练课程管理API
const coachCourseApi = {
    // 获取当前教练的课程列表
    list(query) {
        return service.get('/coach/course/list', { params: query })
    },
    
    // 添加课程
    add(data) {
        return service.post('/coach/course/add', data)
    },
    
    // 更新课程
    update(data) {
        return service.put('/coach/course/update', data)
    },
    
    // 根据ID删除课程
    deleteById(id) {
        return service.delete(`/coach/course/deleteById/${id}`)
    },
    
    // 批量删除课程
    deleteAll(ids) {
        return service.delete(`/coach/course/deleteAll/${ids}`)
    },
    
    // 根据ID查询课程详情
    selectById(id) {
        return service.get(`/coach/course/selectById/${id}`)
    },
    
    // 更新课程状态
    updateStatus(id, status) {
        return service.put(`/coach/course/updateStatus/${id}/${status}`)
    },
    
    // 导出课程Excel
    exportExcel() {
        return service({
            url: `/coach/course/exportExcel`,
            method: 'get',
            responseType: 'blob'
        })
    },
    
    // 导入课程Excel
    importExcel(file) {
        const formData = new FormData()
        formData.append('file', file)
        return service.post('/coach/course/importExcel', formData, {
            headers: {
                'Content-Type': 'multipart/form-data'
            }
        })
    }
}

export default coachCourseApi

